
var timeArr=timeData();
function timeData(){
	var hoursBox=document.querySelectorAll(".hours");
	var textArr=[];
	for(var i=0,len=hoursBox.length;i<len;i++){
		textArr.push(parseInt(hoursBox[i].innerText));
	}
	textArr.push(18);
	return textArr;
}
function changeRuler(hours,minutes,len){//时间标尺；
	var date=new Date();
	var bodyClientWidth=document.body.clientWidth;
	var bodyClientHeight=document.body.clientHeight;
	var oMeetRoom=document.querySelectorAll(".meetRoom")[0];
	var oRuler=document.querySelectorAll("#ruler")[0];
	var oCol=document.querySelectorAll(".title .col")[1];//每一个时间小格；
	var colWidth=oCol.clientWidth;
	var colHeight=oCol.clientHeight;
	var oRoomId=document.querySelectorAll(".title .col")[0];//房间容器；
	var h=0;
	var Left=0;//距离八点钟left值；
	var min_px=colWidth/60;//一分钟代表4px；
	if(hours>=8 && hours<=18){
		h=hours-8;
		Left=h*colWidth+minutes*min_px+oRoomId.clientWidth;
	}else{
		Left=oRoomId.clientWidth;
	}
	oRuler.style.width=2+"px";
	oRuler.style.height=30*len+"px";
	oRuler.style.top=0+"px";
	oRuler.style.left=Left+"px";
}
function getDays(year,month){//计算某月多少天；
	month=parseInt(month,10);
	var date=new Date(year,month,0);
	return date.getDate();
}

function weekDay(scope){
	var date=new Date();
	var year=date.getFullYear();
	var month=date.getMonth()+1;
	if(month<10){
		month="0"+month;
	}
	var today=date.getDate();
	if(today<10){
		today="0"+today;
	}
	var arr=[];
	var weekArr=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");  
	var weekNum=new Date().getDay();
	var week=weekArr[weekNum];
	arr[0]={"week":"Today","time":today+"/"+month,"date":year+"-"+month+"-"+today};
	var day=today;
	var monthNum=month;
	if(today==1){
		for(var i=1;i<=10;i++){
			weekNum++;
			if(day>=getDays(year,month)){
				if(weekNum == 6){
					day=3;
					//start
					day=1;
					//end
				}else if(weekNum == 0){
					day=2;
					//start
					day=1;
					//end
				}else{
					day=1;
				}
				monthNum=monthNum*1+1;
				if(monthNum==13){
					monthNum=1;
				}
			}else{
				if(weekNum==6){
	//				day+=2;
					
					day=parseInt(day)+3;
					
					if(day>=getDays(year,month)){
						if(weekNum == 6){
							day=3;
							//start
							day=1;
							//end
						}else if(weekNum == 0){
							day=2;
							//start
							day=1;
							//end
						}else{
							day=1;
						}
						month=month*1+1;
						monthNum=monthNum*1+1;
						if(monthNum==13){
							monthNum=1;
						}
					}
				}else if(weekNum==0){
	//				day+=1;
					day=parseInt(day)+2;
					if(day>=getDays(year,month)){
						if(weekNum == 6){
							day=3;
							//start
							day=1;
							//end
						}else if(weekNum == 0){
							day=2;
							//start
							day=1;
							//end
						}else{
							day=1;
						}
						month=month*1+1;
						monthNum=monthNum*1+1;
						if(monthNum==13){
							monthNum=1;
						}
					}
				}else{
	//				day++;
					day=parseInt(day)+1;
				}
			}
			
			if(day<10){
				day="0"+day;
			}
			if(monthNum<10){
				monthNum="0"+monthNum*1;
			}
			if(weekNum==6){
				weekNum=1;
				week=weekArr[1];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else if(weekNum==0){
				weekNum=1;
				week=weekArr[1];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else if(weekNum>=7){
				weekNum=weekNum-7;
				week=weekArr[weekNum];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else{
				week=weekArr[weekNum];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}
		}
	}else{
		for(var i=1;i<10;i++){
			weekNum++;
			if(day>=getDays(year,month)){//start >=
				if(weekNum == 6){
					day=3;
					//start
//					day=1;
					//end
				}else if(weekNum == 0){
					day=2;
					//start
//					day=1;
					//end
				}else{
					day=1;
				}
				monthNum=monthNum*1+1;
				if(monthNum==13){
					monthNum=1;
				}
			}else{
				if(weekNum==6){
					day=parseInt(day)+3;
					if(day>=getDays(year,month)){
						if(weekNum == 6){
							day=3;
						}else if(weekNum == 0){
							day=2;
						}else{
							day=1;
						}
						month=month*1+1;
						monthNum=monthNum*1+1;
						if(monthNum==13){
							monthNum=1;
						}
					}
				}else if(weekNum==0){
					day=parseInt(day)+2;
					if(day>=getDays(year,month)){
						if(weekNum == 6){
							day=3;
						}else if(weekNum == 0){
							day=2;
						}else{
							day=1;
						}
						month=month*1+1;
						monthNum=monthNum*1+1;
						if(monthNum==13){
							monthNum=1;
						}
					}
				}else{
					day=parseInt(day)+1;
				}
			}
			
			if(day<10){
				day="0"+day*1;
			}
			if(monthNum<10){
				monthNum="0"+monthNum*1;
			}
			if(weekNum==6){
				weekNum=1;
				week=weekArr[1];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else if(weekNum==0){
				weekNum=1;
				week=weekArr[1];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else if(weekNum>=7){
				weekNum=weekNum-7;
				week=weekArr[weekNum];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}else{
				week=weekArr[weekNum];
				arr[i]={"week":week,"time":day+"/"+monthNum,"date":year+"-"+monthNum+"-"+day};
			}
		}
	}
	scope.dateData=arr;
}
function keysrt(key,value){
	return function(a,b){
		return value?(a[key]<b[key]):(a[key]>b[key]);  
	}
}




function clientTimeZone(){
    var timeOffset=new Date().getTimezoneOffset();
    var hour=parseInt(timeOffset/60);
    var munite=timeOffset%60;
    var prefix="m";
    if (hour<0 || munite<0){
        prefix="p";
        hour=-hour;
        if(munite<0){
            munite=-munite;
        }
    }
    hour+=":"; 
    munite+=" ";
    if(hour.length==2){
        hour="0"+hour;
    }
    if(munite.length==2){
        munite="0"+munite;
    }
    return prefix+hour+munite;
}
//function copyAddress(a){
//	var abb=9999;
//	console.log(a);
//	$("body").zclip({
//      path:'js/ZeroClipboard.swf', 
//      copy:function(){//复制内容 
////          return $('.content').val();
//          return abb;
//      },  
//      afterCopy:function(){//复制成功 
//          alert("复制成功");
//      }
//  });
//}

